<template>

  <el-dialog title="变更日志" :visible.sync="dialogVisible" width="90%" :close-on-click-modal="false">
	  
  	<!--主列表数据-->
    <d2-crud
      ref="d2Crud"
      :options="mainTable.options"
      :index-row="mainTable.indexRow"
      :columns="mainTable.columns"
      :data="mainTable.list"
      :selection-row="mainTable.allowSelect"
      :loading="mainTable.loading"
      @selection-change=""
    ></d2-crud>

	  <div slot="footer" class="dialog-footer">
	    <el-button @click="close" size="small">关 闭</el-button>
	  </div>

    <column-link></column-link>

  </el-dialog>
</template>

<script>

import ColumnLink from './column-link';
import ApiMain from '@/api/mch.info';
export default {
  mixins: [
  ],
  props: [
  ],
  components: {
    ColumnLink
  },
  data () {
    return {

      dialogVisible: false,
      mainTable: {
        loading: false,
        options: {
          border             : true,
          stripe             : true,
          highlightCurrentRow: false,
          emptyText          : '暂无数据',
          size               : 'mini',
        },
        indexRow: null,
        allowSelect: false,
        columns: [
          {title: '商户名称', key: 'mchName', align: 'center', showOverflowTooltip: true},
          {title: '商户号', key: 'mchNo', align: 'center', showOverflowTooltip: true},
          {title: '邮箱', key: 'email', align: 'center', showOverflowTooltip: true},
          {title: 'qq', key: 'qq', align: 'center', showOverflowTooltip: true},
          {title: '联系人', key: 'contact', align: 'center', showOverflowTooltip: true},
          {title: '手机号', key: 'mobile', align: 'center', showOverflowTooltip: true},
          {title: '注册地址', key: 'address', align: 'center', showOverflowTooltip: true},
          {title: '注册证书编号', key: 'registerCertificateNo', width: '150', align: 'center', showOverflowTooltip: true},
          {title: '注册地址', key: 'registerAddress', width: '150', align: 'center', showOverflowTooltip: true},
          {title: '法人', key: 'sales', align: 'center', showOverflowTooltip: true},
          {title: '座机', key: 'phone', align: 'center', showOverflowTooltip: true},
          {title: '注册证书', key: 'registerCert', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '公司章程 文件', key: 'companyPolice', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '注册代理人护照', key: 'companyAgentPassport', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '董事登记册', key: 'corporationCert', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '董事决议书', key: 'corporationDecision', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '法团成立表', key: 'nnc', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '注册地址证明', key: 'registerAddressCert', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '银行开户证明/离岸证明', key: 'bankAccountNoCert', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '法人证明', key: 'legalPersonCert', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '办公室证明', key: 'officeCert', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '周年申报表', key: 'nar', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '股权25%以上证件证明', key: 'corporation25PercentCert', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '股权25%以上地址证明', key: 'corporation25PercentAddrCert', align: 'center', showOverflowTooltip: true, component: {
            name: ColumnLink,
          }},
          {title: '操作人', key: 'createBy', align: 'center', showOverflowTooltip: true},
          {title: '更新时间', key: 'createTime', align: 'center', width: '150', showOverflowTooltip: true},
        ],
        list: [],
        pagination: {
          currentPage: 1,
          pageSize   : 50,
          total      : 0,
          pageSizes  : [50, 100, 200]
        },
      },

    }
  },

  methods: {

  	show (id = null) {

      this.id = id;

      this.fetchData();

      this.dialogVisible = true;
    },

    close () {
      this.dialogVisible = false;
      this.$emit('dialog-close');
    },

    fetchData () {
    	this.mainTable.loading = true;
    	ApiMain.log({ id: this.id })
      .then(re => {
      	this.mainTable.loading = false;
        this.mainTable.list = re;
      })
    }

  }

}
</script>
